package org.nanotek.persistence.jpa.base.person;

import javax.persistence.EntityManager;

import org.nanotek.base.person.Person;
import org.nanotek.persistence.inject.PersonTypeDAO;
import org.nanotek.persistence.jpa.BrainzBaseDAO;

@PersonTypeDAO
@SuppressWarnings("unchecked")
public class PersonDAO<T extends Person> extends BrainzBaseDAO<T>{

	
	public PersonDAO() {
		this.baseClass =   (Class<T>) Person.class;
	}
	
	public PersonDAO(Class<T> baseClass, EntityManager entityManager) {
		super(baseClass, entityManager);
	}

	public PersonDAO(Class<T> baseClass) {
		super(baseClass);
	}

	public Person findPerson(Long id)
	{ 
		return super.find(id);
	}
	
	public void persistPerson(T person)
	{ 
		super.persist(person);
	}
	
	public Boolean containsPerson(T person) 
	{ 
		return super.contains(person);
	}
	
	/*public List<Person> findPersonByName(String name) 
	{ 
		CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
		NamePerson namePerson = new NamePerson();
//		nameString.setNameStringType(NameStringType.FirstName);
//		nameString.setPosition(0);
		namePerson.setValue(name);
		CriteriaQuery<Person> personCriteriaQuery = criteriaBuilder.createQuery(Person.class);
		Root<Person> person = personCriteriaQuery.from(Person.class);
//		criteriaBuilder.
//		Predicate namePredicate = criteriaBuilder.in(person.get("name"), nameString);
		Expression exp; 
		return null;
	}*/
	
	
}
